#ifndef BALLITEM_H
#define BALLITEM_H

#include <QGraphicsObject>
class BallItem : public QGraphicsObject
{
public:
    BallItem():
        m_vx(0.0),
        m_vy(0.0),
        m_r(BALL_RADIUS)
    {

    }

    ~BallItem()
    {
    }

    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
    {
        painter->drawPixmap(QRectF(0.0,0.0,28.0,28.0),m_ballImage,QRectF(0.0,0.0,28.0,28.0));
    }

    virtual QRectF boundingRect() const
    {
        return QRectF(0.0,0.0,28.0,28.0);
    }

    void SetBallImage(const QPixmap& image)
    {
        m_ballImage = image;
    }

    QPointF Centre()
    {
        return mapToScene(13.0,13.0);
    }

public:
    QPixmap m_ballImage;
    qreal   m_vx,m_vy,m_r;
};

#endif // BALLITEM_H
